﻿<UserControl x:Class="PAARC.WP7.Controls.GrabberControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             FontFamily="{StaticResource PhoneFontFamilyNormal}"
             FontSize="{StaticResource PhoneFontSizeNormal}"
             Foreground="{StaticResource PhoneForegroundBrush}"
             d:DesignHeight="480"
             d:DesignWidth="480">

    <Grid x:Name="LayoutRoot"
          Height="75">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="OrientationStateGroup">
                <VisualState x:Name="LandscapeLeft" />
                <VisualState x:Name="LandscapeRight">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)"
                                                       Storyboard.TargetName="DragBorder">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <HorizontalAlignment>Right</HorizontalAlignment>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)"
                                                       Storyboard.TargetName="GrabberTextBlock">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <HorizontalAlignment>Right</HorizontalAlignment>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)"
                                                       Storyboard.TargetName="grid">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Thickness>-500,0,0,0</Thickness>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)"
                                                       Storyboard.TargetName="ExplanationTextBlock">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <HorizontalAlignment>Right</HorizontalAlignment>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)"
                                                       Storyboard.TargetName="ExplanationTextBlock">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Thickness>0,0,26,0</Thickness>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimation Duration="0"
                                         To="-14"
                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
                                         Storyboard.TargetName="GrabberTextBlock"
                                         d:IsOptimized="True" />
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.VerticalAlignment)"
                                                       Storyboard.TargetName="GrabberTextBlock">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <VerticalAlignment>Bottom</VerticalAlignment>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimation Duration="0"
                                         To="90"
                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)"
                                         Storyboard.TargetName="GrabberTextBlock"
                                         d:IsOptimized="True" />
                        <PointAnimation Duration="0"
                                        To="1,1"
                                        Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)"
                                        Storyboard.TargetName="GrabberTextBlock"
                                        d:IsOptimized="True" />
                        <DoubleAnimation Duration="0"
                                         To="-4"
                                         Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                         Storyboard.TargetName="GrabberTextBlock"
                                         d:IsOptimized="True" />
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="EnabledStateGroup">
            	<VisualState x:Name="Enabled"/>
            	<VisualState x:Name="Disabled">
            		<Storyboard>
            			<ColorAnimation Duration="0" To="{StaticResource PhoneDisabledColor}" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="DragBorder" d:IsOptimized="True"/>
            		</Storyboard>
            	</VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Border x:Name="DragBorder"
                Width="15"
                ManipulationStarted="DragBorder_ManipulationStarted"
                ManipulationDelta="DragBorder_ManipulationDelta"
                ManipulationCompleted="DragBorder_ManipulationCompleted"
                Tap="DragBorder_Tap"
                HorizontalAlignment="Left"
                Margin="0"
                VerticalAlignment="Bottom"
                Height="75">
            <Border.Background>
                <SolidColorBrush Color="{StaticResource PhoneAccentColor}" />
            </Border.Background>
            <Grid x:Name="grid"
                  Margin="0,0,-500,0">
                <TextBlock x:Name="GrabberTextBlock"
                           Text="TEXT"
                           RenderTransformOrigin="0,0"
                           FontSize="10.667"
                           FontWeight="Bold"
                           IsHitTestVisible="False"
                           Margin="0"
                           UseLayoutRounding="False"
                           d:LayoutRounding="Auto"
                           d:LayoutOverrides="Width"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Bottom">
        			<TextBlock.RenderTransform>
        				<CompositeTransform Rotation="-90"
                                            TranslateY="10" />
        			</TextBlock.RenderTransform>
        			<TextBlock.Foreground>
        				<SolidColorBrush Color="{StaticResource PhoneForegroundColor}" />
        			</TextBlock.Foreground>
                </TextBlock>
                <TextBlock x:Name="ExplanationTextBlock"
                           Text=""
                           VerticalAlignment="Center"
                           HorizontalAlignment="Left"
                           IsHitTestVisible="False"
                           Margin="26,0,0,0">
        			<TextBlock.Foreground>
        				<SolidColorBrush Color="{StaticResource PhoneForegroundColor}" />
        			</TextBlock.Foreground>
                </TextBlock>
            </Grid>
        </Border>

        <!--<Grid x:Name="InputGrid"
              Background="{StaticResource PhoneBackgroundBrush}"
              HorizontalAlignment="Stretch"
              Visibility="Collapsed">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBox x:Name="InputText"
                     HorizontalAlignment="Stretch"
                     LostFocus="InputText_OnLostFocus"                     
                     AcceptsReturn="True"
                     HorizontalContentAlignment="Left"
                     VerticalContentAlignment="Top"
                     TextWrapping="Wrap" />
            <Button x:Name="OKButton"
                    Content="OK"
                    Grid.Column="1"
                    Click="OKButton_Click"
                    HorizontalAlignment="Right"
                    Margin="0"
                    Height="75"
                    VerticalAlignment="Top" />
        </Grid>-->
    </Grid>
</UserControl>
